package com.myzl.coal.client.parse;

import com.myzl.coal.mq.MqService;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.util.CharsetUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.StringRedisTemplate;

import java.util.Map;


/**
 * @author 91941
 */
@Slf4j
public class HttpHandler extends SimpleChannelInboundHandler<HttpObject> {

    @Autowired
    public StringRedisTemplate redisTemplate;
    @Autowired
    public MqService mqService;
    @Qualifier( "parseServiceMap")
    @Autowired
    private  Map<Integer, CommonParseService> parseServiceMap;

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {

        if (msg instanceof HttpRequest){
            ByteBuf aa= Unpooled.copiedBuffer("anina", CharsetUtil.UTF_8);
        }
    }
}
